package com.xhwl.data.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xhwl.common.pojo.cent.sdata.AccountDeleteLog;
import com.xhwl.common.query.cent.sdata.AccountDeleteLogQuery;
import com.xhwl.data.dao.IAccountDeleteLogDao;
import com.xhwl.data.service.IAccountDeleteLogService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: luyi
 * @Description:
 * @Date: Create in 15:39 2022/4/3
 */
@Service
public class AccountDeleteLogServiceImpl extends ServiceImpl<IAccountDeleteLogDao, AccountDeleteLog> implements IAccountDeleteLogService {

    @Autowired
    private IAccountDeleteLogDao accountDeleteLogDao;

    @Override
    public Page<AccountDeleteLog> page(AccountDeleteLogQuery accountDeleteLogQuery, Page page) {
        QueryWrapper<AccountDeleteLog> accountDeleteLogQueryWrapper = new QueryWrapper<>();

        if(StringUtils.isNotEmpty(accountDeleteLogQuery.getName())){
            accountDeleteLogQueryWrapper.like("name", accountDeleteLogQuery.getName());
        }
        if(null != accountDeleteLogQuery.getEnterpriseId()){
            accountDeleteLogQueryWrapper.eq("enterprise_id", accountDeleteLogQuery.getEnterpriseId());
        }
        return accountDeleteLogDao.selectPage(page, accountDeleteLogQueryWrapper);
    }
}
